﻿using System.Data.Entity.ModelConfiguration;

namespace Delphi.Mimir.Data.Entities.Raw.Mappings {
    class RawCorporateActionMap : EntityTypeConfiguration<RawCorporateAction> {
        public RawCorporateActionMap() {
            /******************************************************************
            /* Table
            /*****************************************************************/
            ToTable("raw.eod_corporate_actions");

            /******************************************************************
            /* Primary Key
            /*****************************************************************/
            HasKey(a => a.coa_id);

            /******************************************************************
            /* Index
            /*****************************************************************/
            // None

            /******************************************************************
            /* Relationships
            /*****************************************************************/
            // None

            /******************************************************************
            /* Properties
            /*****************************************************************/
            Property(a => a.coa_id)
                .IsRequired()
                .HasColumnName("coa_id");

            Property(a => a.coa_sym_cd)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(25)
                .HasColumnName("coa_sym_cd");

            Property(a => a.coa_exc_cd)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(25)
                .HasColumnName("coa_exc_cd");

            Property(a => a.coa_action_desc)
                .IsRequired()
                .IsUnicode(false)
                .HasMaxLength(250)
                .HasColumnName("coa_action_desc");

            Property(a => a.coa_action_dt)
                .IsRequired()
                .HasColumnName("coa_action_dt");

            Property(a => a.coa_amount)
                .IsRequired()
                .HasPrecision(18, 6)
                .HasColumnName("coa_amount");
        }
    }
}
